<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-09-29 15:19:39
-->
<template>
  <div id="containe" style="height: 95%;width:280px"></div>
</template>
<script>
import { Bar } from '@antv/g2plot';
export default {
  data(){
    return{
      b4_data:[
  { year: '1951 年', value: 38 },
  { year: '1952 年', value: 52 },
  { year: '1956 年', value: 61 },
  { year: '1957 年', value: 145 },
  { year: '1958 年', value: 48 },
]
      }
    },
    methods: {
      getb4(){
        const bar = new Bar('containe', {
  data:this.b4_data,
  xField: 'value',
  yField: 'year',
  seriesField: 'year',
  legend: {
    position: 'top-left',
  },
});

bar.render();
      }
    },
    mounted(){
      this.getb4()
    }
  }

</script>